import plotly.plotly as py
from plotly.graph_objs import *

def mark_points(points):
    data = Data([
        Scattermapbox(
            lat=points["lat"],
            lon=points["lon"],
            mode='markers',
            marker=Marker(
                size=9
            ),
        )
    ])
    layout = Layout(
        autosize=True,
        hovermode='closest',
        mapbox=dict(
            bearing=0,
            pitch=0,
            zoom=10
        ),
    )

    fig = dict(data=data, layout=layout)
    py.plot(fig, filename='Multiple Mapbox')

def read_trajectory():
    count = 0
    with open("suntao_junjian", "r")as f:
        lon = []
        lat = []
        target_id = f.readline().split()[0]
        for line in f:
            if line.split()[0] == target_id:
                lon.append(str(int(line.split()[2]) / 600000.0))
                lat.append(str(int(line.split()[3]) / 600000.0))
            else:
                points = dict(lon=lon[::1], lat=lat[::1])
                mark_points(points)
                target_id = line.split()[0]
                lon.clear()
                lat.clear()
                print(target_id)
                input("input:")


if __name__ == "__main__":
    mark_points